package com.zhangjinghao.entity;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.util.StringUtils;

import java.util.Date;

@Data
@Accessors(chain = true)
@NoArgsConstructor
public class SelectArg {

    /**
     * 分页
     */
    private Integer pageNum = 1;
    private Integer pageSize = 3;

    /**
     * 查询
     */
    @DateTimeFormat(pattern = "yyyy-MM")
    private Date createStart;
    @DateTimeFormat(pattern = "yyyy-MM")
    private Date createEnd;
    @DateTimeFormat(pattern = "yyyy-MM")
    private Date pastStart;
    @DateTimeFormat(pattern = "yyyy-MM")
    private Date pastEnd;
    //关键字
    private String name;

    public SelectArg(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public boolean isEmpty(){
        if (createStart==null&&createEnd==null&&pastStart==null&&pastEnd==null&&!StringUtils.hasText(name)){
            return true;
        }
        return false;
    }

    /*****************************************************ES*************************************************/
    /*关键字模糊查询*/
    private String keyword;

    /*居住人数*/
    private Integer max;
    private Integer min;

    /*精准查询*/
    private Integer deptId;

}

